package com.qidian.by.util.pool;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Author: CoolPro
 * @Description: 线程池操作类
 * @Time: 2024-05-12 23:03
 **/

public class ThreadTools {
    private static final ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(5, 10, 30, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100));

    public static void redisDelayed(Integer second, Runnable runnable) {
        try {
            Thread.sleep(second);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        threadPoolExecutor.submit(runnable);
    }
}
